using System;
using HslCommunication;

namespace Catastrophe.AutoSulution.TaskM
{
	public class TaskComplete
	{
		/// <summary>
		/// 执行结果
		/// </summary>
		private OperateResult _oprResult;

		/// <summary>
		/// 是否成功执行完成标识
		/// </summary>
		public RunStatusEnum RunStatus { get; set; }

		/// <summary>
		/// 方法名称
		/// </summary>
		public string MethodName { get; set; }

		/// <summary>
		/// 提示信息
		/// </summary>
		public string Message { get; set; }

		/// <summary>
		/// 异常
		/// </summary>
		public Exception Exception { get; set; }

		/// <summary>
		/// 委托方法特性
		/// </summary>
		public ScheduleAttribute ScheduleAb { get; set; }

		/// <summary>
		/// 跳转到目标方法
		/// </summary>
		public Func<TaskComplete, TaskComplete> DstFunc { get; set; }

		/// <summary>
		/// 时间戳
		/// </summary>
		public string TimeStamp => DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff");

		/// <summary>
		/// 调度参数
		/// </summary>
		public object Param { get; set; }

		/// <summary>
		/// 标识
		/// </summary>
		public int? Flag { get; set; } = null;


		/// <summary>
		/// 执行步骤的详情，一个方法处理多个步骤情况下的补充说明
		/// </summary>
		public string TaskStepDetails { get; set; } = "";


		public OperateResult OprResult
		{
			get
			{
				return this._oprResult ?? new OperateResult
				{
					Message = ""
				};
			}
			set
			{
				this._oprResult = value;
			}
		}

		/// <summary>
		/// 进度值
		/// </summary>
		public int ProcessValue { get; set; }
	}
}
